package com.funny.stock.trade.util;

import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;

/**
 * @author pengl
 * @date 2020/11/21
 **/
public class PriceUtils {

    public static List<BigDecimal> calcNextTradePriceList(BigDecimal basePrice,BigDecimal increasePer,BigDecimal decreasePer){
        BigDecimal fIncreasePer = increasePer.divide(BigDecimal.valueOf(100), 2, BigDecimal.ROUND_HALF_UP).add(BigDecimal.ONE);
        BigDecimal fDecreasePer = decreasePer.divide(BigDecimal.valueOf(100), 2, BigDecimal.ROUND_HALF_UP).add(BigDecimal.ONE);
        BigDecimal nSellPrice = basePrice.multiply(fIncreasePer).setScale(2,BigDecimal.ROUND_HALF_UP);
        BigDecimal nBuyPrice = basePrice.multiply(fDecreasePer).setScale(2,BigDecimal.ROUND_HALF_UP);

        return Arrays.asList(nBuyPrice, nSellPrice);
    }

}
